package com.gadgets.busi.bm02.dto;

import com.gadgets.framework.common.dto.BaseDTO;
import com.gadgets.framework.common.util.NumberFormatUtil;

import java.util.HashMap;

/**
 * @author UncleXiu
 * @version V1.0.0
 * @data 2020-11-02
 * 
 */
public class DemendsResultDTO extends BaseDTO {

    /**
     * 原始材料需求
     */
    private HashMap<String, Integer> oriMaterialMap = new HashMap<>();
    /**
     * 合成递归表
     */
    private RecipeResultDTO recipeResultDTO;

    public RecipeResultDTO getRecipeResultDTO() {
        return recipeResultDTO;
    }

    public void setRecipeResultDTO(RecipeResultDTO recipeResultDTO) {
        this.recipeResultDTO = recipeResultDTO;
    }

    public HashMap<String, Integer> getOriMaterialMap() {
        return oriMaterialMap;
    }

    public void setOriMaterialMap(HashMap<String, Integer> oriMaterialMap) {
        this.oriMaterialMap = oriMaterialMap;
    }

    /**
     * 增加原始材料需求
     * @param name              原始材料名称
     * @param increamentNum     原始材料名称需求增量
     */
    public void addOriMap(String name, Double increamentNum){
        if(!oriMaterialMap.containsKey(name)){
            oriMaterialMap.put(name,0);
        }
        oriMaterialMap.put(name, NumberFormatUtil.roundUpForDouble(oriMaterialMap.get(name)+increamentNum));
    }

}
